package org.lisa.crm.controller.report;

import org.lisa.crm.common.util.Result;
import org.lisa.crm.framework.context.BaseController;
import org.lisa.crm.model.Report;
import org.lisa.crm.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by admin on 2018/2/4.
 */
@Controller
@RequestMapping("/report")
public class ReportController extends BaseController{

    @Autowired
    private ReportService reportService;

    @RequestMapping("/{page}")
    public String index(@PathVariable("page") int  page){
        switch (page){
            case 0:
                return "customer_contribution";
            case 1:
                return "customer_gc";
            case 2:
                return "customer_serve";
            default:
                return "500";
        }

    }


    ///report/queryCustomersContribution">
    @RequestMapping("/queryCustomersContribution")
    @ResponseBody
    public List<Report> queryCustomersContribution(String customerName){

        return reportService.queryCustomersContribution(customerName);
    }

    @RequestMapping("/queryCustomersGc")
    @ResponseBody
    public Map<String,Object> queryCustomersGc(){

        return reportService.queryCustomersGc();
    }

    @RequestMapping("/queryCustomersServerAnalysis")
    @ResponseBody
    public  Map<String,Object>  queryCustomersServerAnalysis(){

        return reportService.queryCustomersServerAnalysis();

    }

}
